package com.tang.controller;

import com.tang.model.BlogAll;
import com.tang.model.PageResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("blogAll")
public class BlogAllController {

    @RequestMapping("list")
    public String list(){ return "blogAll/list"; }

    @RequestMapping("listJson")
    @ResponseBody
    public PageResult<BlogAll> listJson(){
        PageResult<BlogAll> result= new PageResult<BlogAll>();
        result.setCode(0);
        result.setCount(300);
        List<BlogAll> list=new ArrayList<BlogAll>();

        BlogAll all1=new BlogAll();
        all1.setId("AAA");
        all1.setTitle("aaa");
        list.add(all1);

        BlogAll all2=new BlogAll();
        all2.setCategory_name("BBB");
        all2.setAuthor_name("bbb");
        list.add(all2);

        result.setData(list);
        return result;
    }

}
